{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Training Pokemon\n", "## Problem Definition\n", "Ash Ketchum is a renowned Pokémon trainer. He thinks that his most beloved Pokémon, Pikachu, could have been injured in the last battle of the Winners Trophy play-offs.\n", "Therefore, the question is:\n", "\n", "should he use Pikachu in the next battle against Team Rocket?\n", "\n", "The trainer thinks that there is a probability of 0.1 of victory. However, if Pikachu participates in the fight, his injury could worsen.\n", "Ash thinks that there is a probability of 0.2 that Pikachu is actually injured from the last battle.\n", "\n", "The utilities (in points) that the trainer employs are:\n", "\n", "- if Pikachu fights, and Ash wins the battle, and Pikachu is not injured, +100;\n", "\n", "- if Pikachu fights, and Ash wins the battle, and Pikachu is injured, +50;\n", "\n", "- if Pikachu fights, and Ash loses the battle, and Pikachu is not injured, 0;\n", "\n", "- if Pikachu fights, and Ash loses the battle, and Pikachu is injured, -50\n", "\n", "- If Pikachu does not fight and Pikachu is injured, the utility is -10, \n", "\n", "- If Pikachu does not fight and Pikachu is not injured, the utility is 0.\n", "\n", "Ash wants to use decision theory to support his decision-making in the battle against Team Rocket.\n", "\n", "**a**. Draw the decision tree for this problem considering that the probabilities of the result of the battle and the injury are independent.\n", "\n", "Ash has one decision to make, with two different alternatives:\n", "\n", "- Pikachu fights: Pikachu fights in the next tournament\n", "- Pikachu does not fight: \n", "\n", "If Pikachu fights, the result of the game can be modeled as a random node with two possible outcomes:\n", "\n", "- Win: Win the battle with probability P(W) = 0.1\n", "- Lose: Lose the battle with a probability P(L) = 1 - P(W) = 0.9\n", "\n", "Independent of the result of the battle, Pikachu might be injured from a previous battle. This can be modeled as a random event:\n", "\n", "- Pikachu injured: Pikachu is injured with probability P(I) = 0.2\n", "- Pikachu is not injured: Pikachu is not injured with probability P(NI) = 0.8\n", "\n", "This yields the following decision tree:\n", "\n", "![Pikachu](img/pikachu.png)\n", "\n", "**b**. Determine which is the best decision for Ash.\n", "We need to determine the expected value of the intermediate random nodes, applying the probabilities:\n", "\n", "$V_3 =50·0.2+0.8·100=90$\n", "\n", "$V_6 =-50·0.2+0.8·0=-10$\n", "\n", "$V_2 =90·0.1-10·0.9=0$\n", "\n", "$V_9 =-10·0.2+0.8·0=-2$\n", "\n", "Finally, to solve the tree, the value of the decision node is calculated as the maximum value minus cost of the different alternatives:\n", "\n", "$V_1 = \\max(V_2, V_9) = 0$\n", "\n", "and the decision is given by the argument of the maximum (argmax), which corresponds to alternative \"Pikachu plays\".\n", "\n", "**c**. Ash could acquire further information about the probabilities of the result of the battle. The additional information determines the result of the battle (Win or lose), and based on previous results, it has a certain accuracy to successfully predict the result of the battle.\n", "Draw again the decision tree to incorporate into the decision problem the acquisition of this imperfect information about the result of the battle, indicating in the corresponding branches the revised probabilities\n", "\n", "The addition information would make Ash review the probabilities of the result of the battle.\n", "\n", "Now, we can model the acquisition of additional information as a decision node with two alternatives: \n", "- Do not acquire additional information\n", "- Acquire additional information\n", "\n", "The result of the additional information can be modeled as a random node with possible events:\n", "\n", "- Predict a win: The additional information may predict a win with probability P(WP)\n", "- Predict a Loss: The additional information may predict a loss, with probability P(LP)\n", "\n", "Finally, it is required to modify the probabilities of the result of the game to take into account the additional information. \n", "\n", "This yields the following decision tree\n", "\n", "![Pikachu additional info](img/pikachu_additional_info.png)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 0 }